<template>
  <div>
    <mt-header fixed title="道路货物运输量专项调查" style="z-index: 999999;">
      <span slot="left" @click="goBack">
        <mt-button icon="back" slot="left">返回</mt-button>
      </span>
      <!-- <mt-button v-if="reportedByOther=='1' || information=='业户'" icon slot="right" @click.native="insertDate">新增</mt-button> -->
      <mt-button  v-if="((reportedByOther==1&&information=='调查员')||(reportedByOther==0&&information=='业户'))" icon slot="right" @click.native="insertDate">新增</mt-button>
    </mt-header>
    <el-table border :data="tableData4" style="width: 100%" max-height="450">
      <el-table-column fixed prop="xh" label="序号" width="50" align="center"></el-table-column>
      <el-table-column prop="cphm" label="车牌号码" width="90" align="center"></el-table-column>
      <el-table-column prop="cpys" label="车牌颜色" width="90" align="center"></el-table-column>
      <el-table-column prop="rq" label="日期" width="90" align="center"></el-table-column>
      <el-table-column prop="tcxh" label="趟次序号" width="80" align="center"></el-table-column>
      <el-table-column prop="tcs" label="趟次数(个)" width="80" align="center"></el-table-column>
      <el-table-column prop="qd" label="起点" width="105" align="center"></el-table-column>
      <el-table-column prop="zd" label="终点" width="105" align="center"></el-table-column>
      <el-table-column prop="hwzl" label="货物种类" width="80" align="center"></el-table-column>
      <el-table-column prop="dtcyl" label="单趟次运量(吨)" width="120" align="center"></el-table-column>
      <el-table-column prop="dtchwzzl" label="单趟次货物周转量(吨公里)" width="120" align="center"></el-table-column>
      <el-table-column prop="pjyj" label="平均运距（公里）" width="120" align="center"></el-table-column>
      <el-table-column prop="dtcjzxyl" label="单趟次集装箱运量(TEU)" width="120" align="center"></el-table-column>
      <el-table-column label="操作" width="120" align="center">
        <template slot-scope="scope"> 
          <el-button
            v-if="((reportedByOther==1&&information=='调查员')||(reportedByOther==0&&information=='业户'))"
            @click.native.prevent="deleteRow(scope.$index, tableData4)"
            type="text"
            size="small"
          >移除</el-button>
          <el-button v-if="((reportedByOther==1&&information=='调查员')||(reportedByOther==0&&information=='业户'))" @click.native.prevent="updateRow(scope.$index)" type="text" size="small">修改</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-table
      border
      :data="tableData6"
      style="width: 100%"
      max-height="200"
      :span-method="objectSpanMethod"
    >
      <el-table-column prop="zb" label="指标" width="60" align="center"></el-table-column>
      <el-table-column prop="alltcs" label="趟次数(个)" width="80" align="center"></el-table-column>
      <el-table-column prop="allhyl" label="货运量（吨）" width="80" align="center"></el-table-column>
      <el-table-column prop="allhyzzl" label="货物周转量(吨公里)" width="80" align="center"></el-table-column>
      <el-table-column prop="alljzxxyl" label="集装箱箱运量(TEU)" width="80" align="center"></el-table-column>
      <el-table-column prop="allhl" label="货类" width="110" align="center"></el-table-column>
      <el-table-column prop="mtjzp" label="煤炭及制品" width="110" align="center"></el-table-column>
      <el-table-column prop="jsks" label="金属矿石" width="110" align="center"></el-table-column>
      <el-table-column prop="kjcljsn" label="扩建材料及水泥" width="110" align="center"></el-table-column>
      <el-table-column prop="jxsbdq" label="机械设备电器" width="110" align="center"></el-table-column>
      <el-table-column prop="qgyycp" label="轻工医药产品" width="110" align="center"></el-table-column>
      <el-table-column prop="xhncp" label="鲜活农产品" width="110" align="center"></el-table-column>
      <el-table-column prop="qt" label="其他" width="110" align="center"></el-table-column>
    </el-table>
    <table >
            <tr v-for = 'item in errorMessage'>
                <td style="color:blue">{{item}}</td>
            </tr>
        </table>
  </div>
</template>
      
      <script>
      import {Toast} from 'mint-ui'
      import { Indicator } from 'mint-ui';
export default {
  data() {
    return {
      dtcylFlag:false,
      pjyjFlag:false,
      errorMessage: [],
      iosProvincesName: "",
      iosCitysName: "",
      iosCountysName: "",
      //省市县
      provincesArray : '',
      cityArray : '',
      countyArray : '',
      xh: 0,
      tableData6: [
        {
          zb: "合计",
          alltcs: "",
          allhyl: "",
          allhyzzl: "",
          alljzxxyl: "",
          allhl: "货运量（吨）",
          mtjzp: "",
          jsks: "",
          kjcljsn: "",
          jxsbdq: "",
          qgyycp: "",
          xhncp: "",
          qt: ""
        },
        {
          zb: "合计",
          alltcs: "",
          allhyl: "",
          allhyzzl: "",
          alljzxxyl: "",
          allhl: "周转量（吨公里）",
          mtjzp: "",
          jsks: "",
          kjcljsn: "",
          jxsbdq: "",
          qgyycp: "",
          xhncp: "",
          qt: ""
        }
      ],
      tableData4: [
        {
          recid: "",
          floatorder: "",
          xh: "1",
          cphm: "",
          cpys:"",
          rq: "",
          tcxh: "",
          tcs: "",
          qd: "",
          zd: "",
          hwzl: "",
          dtcyl: "",
          dtchwzzl: "",
          pjyj: "",
          dtcjzxyl: ""
        }
      ],
      // 根据公司状态判定新增按钮是否显示 add by qzn 20190625
      reportedByOther: this.$route.query.reportedByOther,
      information: this.$route.query.information,
    };
  },
  watch: {},
  mounted() {
    this. getCityData();
  },
  methods: {
    allgetCode() {
      let alltcs = 0; // 合计：指标：趟次数（个
      let allhyl = 0; // 合计：指标货运量（吨）
      let allhyzzl = 0; // 合计指标--->>货物周转量(吨公里
      let alljzxxyl = 0; // 集装箱箱运量（TEU）
      // 合计中的分开的货运量或者周转量
      let mtjzp0 = 0;
      let jsks0 = 0;
      let kjcljsn0 = 0;
      let jxsbdq0 = 0;
      let qgyycp0 = 0;
      let xhncp0 = 0;
      let qt0 = 0;
      // 合计中的分开的货运量或者周转量
      let mtjzp = 0;
      let jsks = 0;
      let kjcljsn = 0;
      let jxsbdq = 0;
      let qgyycp = 0;
      let xhncp = 0;
      let qt = 0;
      this.tableData4.forEach(item => {
        if(item.tcs != undefined && item.tcs != ""){
            alltcs += parseFloat(item.tcs);
            if(item.dtcjzxyl != undefined && item.dtcjzxyl != ""){
                alljzxxyl += parseInt(item.tcs) * parseInt(item.dtcjzxyl);
            }
            if(item.dtcyl != undefined && item.dtcyl != ""){
                allhyl += parseFloat(item.tcs) * parseFloat(item.dtcyl);
                if(item.pjyj != undefined && item.pjyj != ""){
                    allhyzzl += parseFloat(item.tcs) * parseFloat(item.dtcyl) * parseFloat(item.pjyj);
                    //合计周转量
                    if (item.hwzl == "煤炭及制品") {
                      mtjzp +=
                        parseFloat(item.tcs) *
                        parseFloat(item.dtcyl) *
                        parseFloat(item.pjyj);
                    }
                    if (item.hwzl == "金属矿石") {
                      jsks +=
                        parseFloat(item.tcs) *
                        parseFloat(item.dtcyl) *
                        parseFloat(item.pjyj);
                    }
                    if (item.hwzl == "矿建材料及水泥") {
                      kjcljsn +=
                        parseFloat(item.tcs) *
                        parseFloat(item.dtcyl) *
                        parseFloat(item.pjyj);
                    }
                    if (item.hwzl == "机械设备电器") {
                      jxsbdq +=
                        parseFloat(item.tcs) *
                        parseFloat(item.dtcyl) *
                        parseFloat(item.pjyj);
                    }
                    if (item.hwzl == "轻工医药产品") {
                      qgyycp +=
                        parseFloat(item.tcs) *
                        parseFloat(item.dtcyl) *
                        parseFloat(item.pjyj);
                    }
                    if (item.hwzl == "鲜活农产品") {
                      xhncp +=
                        parseFloat(item.tcs) *
                        parseFloat(item.dtcyl) *
                        parseFloat(item.pjyj);
                    }
                    if (item.hwzl == "其他") {
                      qt +=
                        parseFloat(item.tcs) *
                        parseFloat(item.dtcyl) *
                        parseFloat(item.pjyj);
                    }
                }
                //合计货运量
                if (item.hwzl == "煤炭及制品") {
                  mtjzp0 += parseFloat(item.tcs) * parseFloat(item.dtcyl);
                }
                if (item.hwzl == "金属矿石") {
                  jsks0 += parseFloat(item.tcs) * parseFloat(item.dtcyl);
                }
                if (item.hwzl == "矿建材料及水泥") {
                  kjcljsn0 += parseFloat(item.tcs) * parseFloat(item.dtcyl);
                }
                if (item.hwzl == "机械设备电器") {
                  jxsbdq0 += parseFloat(item.tcs) * parseFloat(item.dtcyl);
                }
                if (item.hwzl == "轻工医药产品") {
                  qgyycp0 += parseFloat(item.tcs) * parseFloat(item.dtcyl);
                }
                if (item.hwzl == "鲜活农产品") {
                  xhncp0 += parseFloat(item.tcs) * parseFloat(item.dtcyl);
                }
                if (item.hwzl == "其他") {
                  qt0 += parseFloat(item.tcs) * parseFloat(item.dtcyl);
                }
            }
        }        
      });
      this.tableData6[0].alltcs = alltcs;//趟次数
      this.tableData6[0].allhyl = this.keepTwoDecimalFull(allhyl);//货运量
      this.tableData6[0].allhyzzl = this.keepTwoDecimalFull(allhyzzl);//货物周转量
      this.tableData6[0].alljzxxyl = this.keepTwoDecimalFull(alljzxxyl);//集装箱箱运量
      //货运量
      this.tableData6[0].mtjzp = mtjzp0;
      this.tableData6[0].jsks = jsks0;
      this.tableData6[0].kjcljsn = kjcljsn0;
      this.tableData6[0].jxsbdq = jxsbdq0;
      this.tableData6[0].qgyycp = qgyycp0;
      this.tableData6[0].xhncp = xhncp0;
      this.tableData6[0].qt = qt0;
      //周转量
      this.tableData6[1].mtjzp = mtjzp;
      this.tableData6[1].jsks = jsks;
      this.tableData6[1].kjcljsn = kjcljsn;
      this.tableData6[1].jxsbdq = jxsbdq;
      this.tableData6[1].qgyycp = qgyycp;
      this.tableData6[1].xhncp = xhncp;
      this.tableData6[1].qt = qt;

      this.saveData();
    },
    goBack() {
      //点击后退
      this.$router.go(-1);
    },
    objectSpanMethod({ row, column, rowIndex, columnIndex }) {
      if (
        columnIndex === 0 ||
        columnIndex === 1 ||
        columnIndex === 2 ||
        columnIndex === 3 ||
        columnIndex === 4
      ) {
        if (rowIndex % 2 === 0) {
          return {
            rowspan: 2,
            colspan: 1
          };
        } else {
          return {
            rowspan: 0,
            colspan: 0
          };
        }
      }
    },
    getCode() {
      let data = {};
      data.yhmlkRecid = this.$route.query.yhmlk;
      this.axios
        .post(
          "http://zxdc.catsic.com:9090/sampling/assit/findFzdcbfd01",
          { data: data },
          {
            headers: {
              "Content-Type": "application/json",
              mobileHeader:
                '{"sessionId":' + localStorage.getItem("sessionId") + "}"
            }
          }
        )
        .then(
          result => {
            Indicator.close();
            //console.log("result-->>"+JSON.stringify(result))
            if (result.data.status == "1000") {
              this.tableData4.splice(0);
              if( result.data.data.MSG != "没有查询到结果"){
                this.xh = 0;
                this.pjyjFlag = false;
                this.dtcylFlag = false;
                this.errorMessage = [];
                  result.data.data.Fzdcbfd01.forEach(item => {
                let tableData = {};
                tableData.recid = item.recid;
                tableData.floatorder = item.floatorder;
                tableData.xh = ++this.xh;
                (tableData.cphm = item.fzdcbfd12019001),
                (tableData.cpys = this.getCarColorName(item.plateColorCode)),
                  (tableData.rq = item.fzdcbfd12019002),
                  (tableData.tcxh = item.fzdcbfd12019003),
                  (tableData.tcs = item.fzdcbfd12019004),

                  (tableData.qd = this.getCityName(item.fzdcbfd12019005)),
                  (tableData.zd = this.getCityName(item.fzdcbfd12019006)),
                  (tableData.hwzl = this.getGoodsTypeNmae(item.fzdcbfd12019007)),

                  (tableData.dtcyl = this.keepTwoDecimalFull(item.fzdcbfd12019008)),
                  
                  (tableData.dtchwzzl = this.keepTwoDecimalFull(item.fzdcbfd12019009)),
                  (tableData.pjyj = this.keepTwoDecimalFull(item.fzdcbfd12019010)),
                  (tableData.dtcjzxyl = this.keepTwoDecimalFull(item.fzdcbfd12019011)),
                  this.tableData4.push(tableData);
                  
                  if(tableData.cphm == ""){
                      this.errorMessage.push("序号"+tableData.xh+" 提示性错误：车牌号码不能为空，请修改！");
                  }
                  if(tableData.cpys == "" || tableData.cpys == undefined){
                      this.errorMessage.push("序号"+tableData.xh+" 提示性错误：车牌颜色不能为空，请修改！");
                  }
                  if(tableData.rq == "" || tableData.rq == undefined){
                      this.errorMessage.push("序号"+tableData.xh+" 提示性错误：日期不能为空，请修改！");
                  }
                  if(tableData.tcxh == "" || tableData.tcxh == undefined){
                      this.errorMessage.push("序号"+tableData.xh+" 提示性错误：趟次序号不能为空，请修改！");
                  }
                  if(tableData.tcs == "" || tableData.tcs == undefined){
                      this.errorMessage.push("序号"+tableData.xh+" 提示性错误：趟次数不能为空，请修改！");
                  }
                  if(tableData.qd == "" || tableData.qd == undefined){
                      this.errorMessage.push("序号"+tableData.xh+" 提示性错误：起点不能为空，请修改！");
                  }
                  if(tableData.zd == "" || tableData.zd == undefined){
                      this.errorMessage.push("序号"+tableData.xh+" 提示性错误：终点不能为空，请修改！");
                  }
                  if(tableData.hwzl == "" || tableData.hwzl == undefined){
                      this.errorMessage.push("序号"+tableData.xh+" 提示性错误：货物种类不能为空，请修改！");
                  }
                  if(tableData.dtcyl == "" || tableData.dtcyl == undefined){
                      this.errorMessage.push("序号"+tableData.xh+" 提示性错误：单趟次运量不能为空，请修改！");
                  }
                  if((tableData.dtchwzzl == "" || tableData.dtchwzzl == undefined) && (tableData.pjyj == "" || tableData.pjyj == undefined)){
                      this.errorMessage.push("序号"+tableData.xh+" 提示性错误：单趟次货物周转量和平均运距其中一项不能为空，请修改！");
                  }
                  if(parseFloat(tableData.dtcyl) > 150){
                      this.errorMessage.push("序号"+tableData.xh+" 提示性错误：单趟次运量应小于等于150，请修改！");
                  }
                  if(parseFloat(tableData.pjyj) > 4500){
                      this.errorMessage.push("序号"+tableData.xh+" 提示性错误：单趟次平均运距应小于等于4500，请修改！");
                  }
                  if(tableData.dtchwzzl != "" && tableData.dtchwzzl != undefined && tableData.dtcyl != "" && tableData.dtcyl != undefined 
                    && tableData.pjyj != "" && tableData.pjyj != undefined){
                      if(parseFloat(tableData.dtcyl) > 0 && parseFloat(tableData.dtchwzzl) > 0){
                        let result =  parseFloat(tableData.dtchwzzl)/parseFloat(tableData.dtcyl);
                        if(result > parseFloat(tableData.pjyj)+0.1 || result < parseFloat(tableData.pjyj)-0.1){
                          this.errorMessage.push("序号"+tableData.xh+" 提示性错误：单趟次货物周转量除以单趟次运量应大于平均运距减0.1且小于平均运距加0.1，请修改！");
                        }
                      }
                  }
              });
              }
              
            }
            this.allgetCode();
          },
          error => {
            Indicator.close();
            console.log("getyhcars request error:" + error);
          }
        );
      console.log(this.$route.query.yhmlk);
    },
    insertDate() {
      this.$router.push({
        path: "/home/auxiliaryTableOneInsert/:yhmlk",
        query: { yhmlk: this.$route.query.yhmlk }
      });
    },
    deleteRow(index) {
      let data = {};
      data.recid = this.tableData4[index].recid;
      this.axios
        .post(
          "http://zxdc.catsic.com:9090/sampling/assit/deleteFzdcbfd01",
          { data: data },
          {
            headers: {
              "Content-Type": "application/json",
              mobileHeader:
                '{"sessionId":' + localStorage.getItem("sessionId") + "}"
            }
          }
        )
        .then(
          result => {
            if (result.data.status == "1000") {
              this.getCode();
              console.log(result);
            }
          },
          error => {
            console.log("getyhcars request error:" + error);
          }
        );
      console.log(index, this.tableData4[index]);
      this.getCode();
    },
    updateRow(index) {
      this.$router.push({
        path: "/home/auxiliaryTableOneUpdate/:yhmlk/:recid/:floatorder",
        query: {
          yhmlk: this.$route.query.yhmlk,
          recid: this.tableData4[index].recid,
          floatorder: this.tableData4[index].floatorder
        }
      });
      console.log(index, this.tableData4[index]);
    },
    //保存固定行数据
    saveData() {
                let data = {};
                let fzdcbfd01Total = {};
                //localStorage.setItem('fzb1recid', "");
                console.log(localStorage.getItem(this.$route.query.yhmlk+'fzb1recid')+"-------");
                if(localStorage.getItem(this.$route.query.yhmlk+'fzb1recid')!=null){
                  fzdcbfd01Total.recid = localStorage.getItem(this.$route.query.yhmlk+'fzb1recid');    
                } else {
                  fzdcbfd01Total.recid = '';
                }
                
                fzdcbfd01Total.yhmlk = this.$route.query.yhmlk;
                fzdcbfd01Total.fzdcbgd12019001 = this.tableData6[0].alltcs;
                fzdcbfd01Total.fzdcbgd12019002 = this.tableData6[0].allhyl;
                fzdcbfd01Total.fzdcbgd12019003 = this.tableData6[0].allhyzzl;
                fzdcbfd01Total.fzdcbgd12019004 = this.tableData6[0].alljzxxyl;

                fzdcbfd01Total.fzdcbgd12019005 = this.tableData6[0].mtjzp;
                fzdcbfd01Total.fzdcbgd12019006 = this.tableData6[1].mtjzp;

                fzdcbfd01Total.fzdcbgd12019007 = this.tableData6[0].jsks;
                fzdcbfd01Total.fzdcbgd12019008 = this.tableData6[1].jsks;

                fzdcbfd01Total.fzdcbgd12019009 = this.tableData6[0].kjcljsn;
                fzdcbfd01Total.fzdcbgd12019010 = this.tableData6[1].kjcljsn;

                fzdcbfd01Total.fzdcbgd12019011 = this.tableData6[0].jxsbdq;
                fzdcbfd01Total.fzdcbgd12019012 = this.tableData6[1].jxsbdq;

                fzdcbfd01Total.fzdcbgd12019013 = this.tableData6[0].qgyycp;
                fzdcbfd01Total.fzdcbgd12019014 = this.tableData6[1].qgyycp;

                fzdcbfd01Total.fzdcbgd12019015 = this.tableData6[0].xhncp;
                fzdcbfd01Total.fzdcbgd12019016 = this.tableData6[1].xhncp;

                fzdcbfd01Total.fzdcbgd12019017 = this.tableData6[0].qt;
                fzdcbfd01Total.fzdcbgd12019018 = this.tableData6[1].xhncp;
                data.fzdcbfd01Total = fzdcbfd01Total;
                
                // console.log("保存总计"+JSON.stringify(data));
                this.axios.post('http://zxdc.catsic.com:9090/sampling/assit/addFzdcbfd01Total', {'data': data}, {
                    'headers': {
                        'Content-Type': 'application/json',
                        'mobileHeader': '{"sessionId":' + localStorage.getItem('sessionId') + '}'
                    }
                }).then(result => {
                    console.log(result);
                    if (result.data.status == "1000") {
                        
                        if( result.data.data.MSG == "新增分车分趟次运输表总计成功"){
                            localStorage.setItem(this.$route.query.yhmlk+'fzb1recid', result.data.data.gdRecid);
                        }
                    } else if (result.data.status === "1001") {
                        Toast(result.data.msg);
                    } else if (result.data.status == "4001" || result.data.status == "5005" || result.data.status == "1002") {
                        Toast(result.data.msg);
                    } else if (result.data.status === "5001") {
                        Toast(result.data.msg);
                    }
                }, error => {
                    Toast("网络异常");
                    console.log("getuserinfo request error:" + error);
                });
            },
                getCityData(){
                  
                  console.log(this.reportedByOther+this.information);
                    Indicator.open({
                      text: '加载数据...',
                      spinnerType: 'fading-circle'
                    });
                    this.axios.get("http://zxdc.catsic.com:9090/sampling/json/city").then( 
                        response => {
                            

                            this.provincesArray = response.data.iosProvinces;
                            this.cityArray = response.data.iosCitys;
                            this.countyArray = response.data.iosCountys;
                            
                             this.getCode();
                        },
                        response => {
                            console.log("数据加载失败");
                        }
                    );
                },
                getCityName(code){
                  let countyParentId = '', cityParentId = '';
                            
                            for(let i=0; i<this.countyArray.length; i++){
                                if(code == this.countyArray[i].id){
                                    this.iosCountysName = this.countyArray[i].value;
                                    countyParentId = this.countyArray[i].parentId;           
                                }
                            }
                            for(let j=0; j<this.cityArray.length; j++){
                                if(countyParentId == this.cityArray[j].id){
                                    this.iosCitysName = this.cityArray[j].value;
                                    cityParentId = this.cityArray[j].parentId;                                    
                                }
                            }
                            for(let n=0; n<this.provincesArray.length; n++){
                                if(cityParentId == this.provincesArray[n].id){
                                    this.iosProvincesName = this.provincesArray[n].value;                                  
                                }
                            }
                            return (this.iosProvincesName+"-"+this.iosCitysName+"-"+this.iosCountysName);
                },
                // 获取车牌颜色名称
                getCarColorName(code) {
                  var goodsTypes = [
                    {
                      code: "1",
                      name: "蓝色"
                    },
                    {
                      code: "2",
                      name: "黄色"
                    },
                    {
                      code: "3",
                      name: "黑色"
                    },
                    {
                      code: "4",
                      name: "白色"
                    },
                    {
                      code: "5",
                      name: "黄绿"
                    },
                    {
                      code: "6",
                      name: "渐变绿"
                    },
                    {
                      code: "9",
                      name: "其他"
                    }
                  ];
                  var name;
                  goodsTypes.forEach(item => {
                    if (item.code === code) {
                      name = item.name;
                    }
                  });
                  return name;
              },
                getGoodsTypeNmae(code) {// 获取货物类型名称
                  var goodsTypes = [
                    {
                      code: "1",
                      name: "煤炭及制品"
                    },
                    {
                      code: "2",
                      name: "金属矿石"
                    },
                    {
                      code: "3",
                      name: "矿建材料及水泥"
                    },
                    {
                      code: "4",
                      name: "机械设备电器"
                    },
                    {
                      code: "5",
                      name: "轻工医药产品"
                    },
                    {
                      code: "6",
                      name: "鲜活农产品"
                    },
                    {
                      code: "9",
                      name: "其他"
                    }
                  ];
                  var name;
                  goodsTypes.forEach(item => {
                    if (item.code === code) {
                      name = item.name;
                    }
                  });
                  return name;
              },
              keepTwoDecimalFull(num) {
                if(num==""||num==undefined){
                  return ""
                }
                num += 0.0049;
                var result = parseFloat(num);
                if (isNaN(result)) {
                  //alert("传递参数错误，请检查！");
                  return num;
                }
                result = this.keepIntegerDecimalFull(num * 100) / 100;
                var s_x = result.toString();
                var pos_decimal = s_x.indexOf(".");
                if (pos_decimal < 0) {
                  pos_decimal = s_x.length;
                  s_x += ".";
                }
                while (s_x.length <= pos_decimal + 2) {
                  s_x += "0";
                }
                return s_x;
              },
    // 保留整数
    keepIntegerDecimalFull(num){
      if(num==""||undefined){
        return ""
      }
      return Math.round(num)
    }
  }
};
</script>